function Export-CSV {
    param(
        [switch]$export,
        [string]$inputString
    )
    
    if ($export) {
        $inputString | Out-File "output.csv" -Append
        Write-Host "内容已导出到 output.csv"
    } else {
        $inputString
    }
}

# 调用时使用命名参数更清晰
# Export-CSV -export -inputString "Hello World"
# Export-CSV -inputString "Hello PowerShell"
# erro type and content: function name missing hyphen
Export-CSV  -inputString "Hello World 1"
Export-CSV  -inputString "Hello PowerShell 2"
export-csv -export -inputString "Hello World 2"
# no use for using true or false replacing -export
# export-CSV true "Hello World 3"

<# 
PS : as to after -export, no need to write true or false, just write -export means true, not write means false;
#>